/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Connection;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Tomcat
 */
public class ConnectionDB {
    public static Connection Connect() {
        Connection cn  =null;
        String server = "localhost";
        String port = "1433";
        String database = "PrimePhysique";
        String username = "sa";
        String password = "123";

        String url = "jdbc:sqlserver://"+server+":"+port+";databaseName=" + database;
        try {
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
            cn = DriverManager.getConnection(url, username, password);
        } catch (SQLException ex) {
            Logger.getLogger(ConnectionDB.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(Connection.class.getName()).log(Level.SEVERE, null, ex);
        }
        return cn;
    }
}
